var nowDate = getDay(0);
var pageType = sessionStorage.getItem('pageType');
var shopcode = GetQueryString('shopcode');
var calendar = new lCalendar();
var startDatecalendar = new lCalendar();
var endDatecalendar = new lCalendar();
var url;
startDatecalendar.init({
	'trigger': '#startDate',
	'type': 'date',
	'minDate': '2022-01-01',
	'maxDate': '2099-12-31'
});
endDatecalendar.init({
	'trigger': '#endDate',
	'type': 'date',
	'minDate': '2022-01-01',
	'maxDate': '2099-12-31'
});
function ICalendarClick(){
//	onload()
}
$(document).ready(function(){
	$('#name').text(sessionStorage.getItem("name"));
	$('#startDate').val(nowDate);
	$('#endDate').val(nowDate);
	$('#searchButton').on('click',function(){
		getTypePingjia();
	});
	getTypePingjia();
});

//查询待评价信息
function getTypePingjia(){
	var sendData = {};
	sendData.shopcode=shopcode;
	sendData.endDate=$('#endDate').val();
	sendData.startDate=$('#startDate').val();
	sendData.pingjiaFlag=0;
	$.ajax({
		url: "../../unite_platform/mobile_page/pingjia/getTypePingjia"
		,type:'post'
//		,async: false
		,data:JSON.stringify(sendData)
		,contentType: "application/json; charset=utf-8"
		,dataType:'json'
		,success: function(res){
			console.log(res)
			
			$('#opeTable').empty();
			if(res.success){
				var resdata = res.data;
				for (var i = 0; i < resdata.length; i++) {
					$('#opeTable').append('<tr class="thin-border-bottom" onclick="startPingjia('+resdata[i].id+',\''+resdata[i].pjId+'\',\''+resdata[i].pingjiaUserName+'\','+resdata[i].flag+',\''+resdata[i].sEmployeeNO+'\',\''+resdata[i].sEmployeeName+'\',\''+resdata[i].pingjiaType+'\')">'
							+'	<td style="padding-left: 0px;padding-right: 0px;display: table-cell; vertical-align: middle;">'+resdata[i].pingjiaTypename+'</span></td>'
							+'	<td style="padding-left: 0px;padding-right: 0px;display: table-cell; vertical-align: middle;">'+resdata[i].pingjiaUserName+'</td>'//id="'+el+obj+i+'"
							+'	<td style="padding-left: 0px;padding-right: 0px;display: table-cell; vertical-align: middle;">'+resdata[i].lrsj+'</td>'//id="'+el+obj+i+'"
							+'	<td style="padding-left: 0px;padding-right: 0px;display: table-cell; vertical-align: middle;" class="orange">去评价</td>'
							+'</tr>');
				}
				
			}else{
//				layer.alert(res.message);
			}
		}
		,error:function(XMLHttpRequest, textStatus, errorThrown) {
			 console.log(XMLHttpRequest);
			 console.log(textStatus);
			 console.log(errorThrown);
			 hideloading();
		}
	});
	
}
//开始评价
function startPingjia(id,pjId,pingjiaUserName,pandianFlag,dudaoNO,dudaoName,pingjiaType){
	//sessionStorage.setItem("shopcode",shopcode);
	//sessionStorage.setItem("shopname",shopname);
	sessionStorage.setItem("dudaoNO",dudaoNO);
	sessionStorage.setItem("dudaoName",dudaoName);
	window.location.href='pingjia_woyaopj?userId='+pjId+'&username='+encodeURI(encodeURI(pingjiaUserName))+'&type=0&pandianid='+id+'&pingjiaType='+pingjiaType;
}